package com.ruoyi.project.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.LiveTrack;
import com.ruoyi.project.system.service.ILiveTrackService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 玩家阵营Controller
 * 
 * @author david
 * @date 2025-06-11
 */
@RestController
@RequestMapping("/data/liveTrack")
public class LiveTrackController extends BaseController
{
    @Autowired
    private ILiveTrackService liveTrackService;

    /**
     * 查询玩家阵营列表
     */
    @PreAuthorize("@ss.hasPermi('data:liveTrack:list')")
    @GetMapping("/list")
    public TableDataInfo list(LiveTrack liveTrack)
    {
        startPage();
        List<LiveTrack> list = liveTrackService.selectLiveTrackList(liveTrack);
        return getDataTable(list);
    }

    /**
     * 导出玩家阵营列表
     */
    @PreAuthorize("@ss.hasPermi('data:liveTrack:export')")
    @Log(title = "玩家阵营", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LiveTrack liveTrack)
    {
        List<LiveTrack> list = liveTrackService.selectLiveTrackList(liveTrack);
        ExcelUtil<LiveTrack> util = new ExcelUtil<LiveTrack>(LiveTrack.class);
        util.exportExcel(response, list, "玩家阵营数据");
    }

    /**
     * 获取玩家阵营详细信息
     */
    @PreAuthorize("@ss.hasPermi('data:liveTrack:query')")
    @GetMapping(value = "/{liveRoomId}")
    public AjaxResult getInfo(@PathVariable("liveRoomId") String liveRoomId)
    {
        return success(liveTrackService.selectLiveTrackByLiveRoomId(liveRoomId));
    }

    /**
     * 新增玩家阵营
     */
    @PreAuthorize("@ss.hasPermi('data:liveTrack:add')")
    @Log(title = "玩家阵营", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LiveTrack liveTrack)
    {
        return toAjax(liveTrackService.insertLiveTrack(liveTrack));
    }

    /**
     * 修改玩家阵营
     */
    @PreAuthorize("@ss.hasPermi('data:liveTrack:edit')")
    @Log(title = "玩家阵营", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LiveTrack liveTrack)
    {
        return toAjax(liveTrackService.updateLiveTrack(liveTrack));
    }

    /**
     * 删除玩家阵营
     */
    @PreAuthorize("@ss.hasPermi('data:liveTrack:remove')")
    @Log(title = "玩家阵营", businessType = BusinessType.DELETE)
	@DeleteMapping("/{liveRoomIds}")
    public AjaxResult remove(@PathVariable String[] liveRoomIds)
    {
        return toAjax(liveTrackService.deleteLiveTrackByLiveRoomIds(liveRoomIds));
    }
}
